<!-- 入住提交 -->
<template>
  <div class="submit-container">
    <div class="main">
      <p class="title">入住确认订单</p>
      <p><span class="text">姓名</span>: {{ readUserInfo.Nickname }}</p>
      <p><span class="text">学号</span>: {{ readUserInfo.studentId }}</p>
      <p><span class="text">手机号</span>: {{ readUserInfo.phone }}</p>
      <p>
        <span class="text">宿舍楼</span>:
        {{ readCheckInfo.dormitory.DormitoryName }}
      </p>
      <p>
        <span class="text">楼层</span>: {{ readCheckInfo.floor.floorNumber }}
      </p>
      <p><span class="text">房间号</span>: {{ readCheckInfo.room.roomNo }}</p>
      <p>
        <span class="text">床位</span>:
        {{ readCheckInfo.bednumber.bednumberId }}
      </p>
      <p class="price">
        <span class="text">价格</span>:
        {{ readCheckInfo.dormitory.RoomRate.price }}元
      </p>
      <div class="but">
        <button @click="confirmOrder">确认订单</button>
      </div>
      <p class="warning">注意: 请仔细查看订单</p>
    </div>
    <Payment v-if="isPaymentRef" @closePay="isPaymentRef = 0"/>
  </div>
</template>

<script setup>
import { useCheckInStore } from "@/store/useCheckInStore.js";
import { useUserStore } from "@/store/useUserStore.js";
import { storeToRefs } from "pinia";
import {ref} from "vue"
import Payment from "./Payment.vue";
const checkIn = useCheckInStore();
const user = useUserStore();
const { readCheckInfo } = storeToRefs(checkIn);
const { readUserInfo } = storeToRefs(user);
const isPaymentRef = ref(false)
function confirmOrder(){
  isPaymentRef.value = true
}
</script>

<style lang="less" scoped>
@import "@/styles/var.less";
.submit-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  .main {
    width: 70%;
    min-width: 1000px;
    min-height: 400px;
    background-color: rgba(28, 35, 39, 0.7);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    box-shadow: 2px 2px 10px #3b3b3b;
    padding: 20px;

    .title {
      font-size: 25px;
      font-weight: bold;
      text-align: center;
      display: block;
    }
    p {
      margin: 10px 0;
      display: flex;
      &.price {
        color: @danger;
      }
      .text {
        width: 50px;
        display: block;
        text-align-last: justify;
      }
    }
    .but {
      width: 100%;
      margin-top: 20px;
      text-align: center;
      button {
        cursor: pointer;
        border-radius: 5px;
        width: 120px;
        height: 50px;
        font-size: 18px;
      }
    }
    .warning {
      display: flex;
      justify-content: center;
      color: @danger;
    }
  }
}
</style>